import { languages } from '@/app/i18n/settings';
import { dir } from 'i18next';
import { type Metadata } from 'next';
import Navbar from './navbar';

import '@/app/global.css';

type Props = {
  children: React.ReactNode;
  params: { lang: Lang };
};

export const metadata: Metadata = {
  title: 'Next Template',
  description: 'Next Template',
  keywords: ['Next Template'],
  authors: [{ name: '静夜聆雨', url: 'dengtaizhong@qq.com' }],
  generator: 'Next.js',
  applicationName: 'Next Template',
  referrer: 'origin-when-cross-origin',
  robots: {
    index: true,
    follow: true,
  },
};

export default function RootLayout({ children, params: { lang } }: Props) {
  return (
    <html lang={lang} dir={dir(lang)}>
      <body>
        <Navbar lang={lang}></Navbar>
        {children}
      </body>
    </html>
  );
}

export async function generateStaticParams() {
  return languages.map((lang) => ({ lang }));
}
